/*
 * complex.h
 *
 * This file is part of the clang port package.
 *
 * Contributors:
 *  Created by Ma Yingkui <@>
 *
 *  THIS SOFTWARE IS NOT COPYRIGHTED
 *
 *  This source code is offered for use in the public domain. You may
 *  use, modify or distribute it freely.
 *
 *  This code is distributed in the hope that it will be useful but
 *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
 *  DISCLAIMED. This includes but is not limited to warranties of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 */

#ifndef _CLANG_PORT_COMPLEX_H_
#define _CLANG_PORT_COMPLEX_H_

/* All the headers include this file. */
#ifndef __IMPL_CLANG_PORT_API_
#	include <_clang_port.h>
#else
#	include <include/_clang_port.h>
#endif

#ifndef __IMPL_CLANG_PORT_API_
#ifndef __cplusplus
#define complex _Complex
#endif

#define _Complex_I  (0.0F +  1.0iF)

/* GCC doesn't support _Imaginary type yet, so we don't
   define _Imaginary_I */

#define I _Complex_I
#endif /* __IMPL_CLANG_PORT_API_ */

#ifdef __cplusplus
extern "C" {
#endif 

	
// builtin functions
#ifndef __IMPL_CLANG_PORT_API_
CLANG_PORT_INLINE double cabs(double complex c)
{
	return CLANG_BUILTIN_CALL(cabs)(c);
}
CLANG_PORT_INLINE float cabsf(float complex c)
{
	return CLANG_BUILTIN_CALL(cabsf)(c);
}
CLANG_PORT_INLINE long double cabsl(long double complex c)
{
	return CLANG_BUILTIN_CALL(cabsl)(c);
}
CLANG_PORT_INLINE double complex cacos(double complex c)
{
	return CLANG_BUILTIN_CALL(cacos)(c);
}
CLANG_PORT_INLINE float complex cacosf(float complex c)
{
	return CLANG_BUILTIN_CALL(cacosf)(c);
}
CLANG_PORT_INLINE long double complex  cacosl(long double complex c)
{
	return CLANG_BUILTIN_CALL(cacosl)(c);
}
CLANG_PORT_INLINE double carg(double complex c)
{
	return CLANG_BUILTIN_CALL(carg)(c);
}
CLANG_PORT_INLINE float cargf(float complex c)
{
	return CLANG_BUILTIN_CALL(cargf)(c);
}
CLANG_PORT_INLINE long double cargl(long double complex c)
{
	return CLANG_BUILTIN_CALL(cargl)(c);
}
CLANG_PORT_INLINE double complex casin(double complex c)
{
	return CLANG_BUILTIN_CALL(casin)(c);
}
CLANG_PORT_INLINE float complex casinf(float complex c)
{
	return CLANG_BUILTIN_CALL(casinf)(c);
}
CLANG_PORT_INLINE long double complex  casinl(long double complex c)
{
	return CLANG_BUILTIN_CALL(casinl)(c);
}
CLANG_PORT_INLINE double complex catan(double complex c)
{
	return CLANG_BUILTIN_CALL(catan)(c);
}
CLANG_PORT_INLINE float complex catanf(float complex c)
{
	return CLANG_BUILTIN_CALL(catanf)(c);
}
CLANG_PORT_INLINE long double complex  catanl(long double complex c)
{
	return CLANG_BUILTIN_CALL(catanl)(c);
}
CLANG_PORT_INLINE double complex ccos(double complex c)
{
	return CLANG_BUILTIN_CALL(ccos)(c);
}
CLANG_PORT_INLINE float complex ccosf(float complex c)
{
	return CLANG_BUILTIN_CALL(ccosf)(c);
}
CLANG_PORT_INLINE double complex ccosh(double complex c)
{
	return CLANG_BUILTIN_CALL(ccosh)(c);
}
CLANG_PORT_INLINE float complex ccoshf(float complex c)
{
	return CLANG_BUILTIN_CALL(ccoshf)(c);
}
CLANG_PORT_INLINE long double complex  ccoshl(long double complex c)
{
	return CLANG_BUILTIN_CALL(ccoshl)(c);
}
CLANG_PORT_INLINE long double complex  ccosl(long double complex c)
{
	return CLANG_BUILTIN_CALL(ccosl)(c);
}
CLANG_PORT_INLINE double complex cexp(double complex c)
{
	return CLANG_BUILTIN_CALL(cexp)(c);
}
CLANG_PORT_INLINE float complex cexpf(float complex c)
{
	return CLANG_BUILTIN_CALL(cexpf)(c);
}
CLANG_PORT_INLINE long double complex  cexpl(long double complex c)
{
	return CLANG_BUILTIN_CALL(cexpl)(c);
}
CLANG_PORT_INLINE double cimag(double complex c)
{
	return CLANG_BUILTIN_CALL(cimag)(c);
}
CLANG_PORT_INLINE float cimagf(float complex c)
{
	return CLANG_BUILTIN_CALL(cimagf)(c);
}
CLANG_PORT_INLINE long double cimagl(long double complex c)
{
	return CLANG_BUILTIN_CALL(cimagl)(c);
}
CLANG_PORT_INLINE double complex clog(double complex c)
{
	return CLANG_BUILTIN_CALL(clog)(c);
}
CLANG_PORT_INLINE float complex clogf(float complex c)
{
	return CLANG_BUILTIN_CALL(clogf)(c);
}
CLANG_PORT_INLINE long double complex  clogl(long double complex c)
{
	return CLANG_BUILTIN_CALL(clogl)(c);
}
CLANG_PORT_INLINE double complex conj(double complex c)
{
	return CLANG_BUILTIN_CALL(conj)(c);
}
CLANG_PORT_INLINE float complex conjf(float complex c)
{
	return CLANG_BUILTIN_CALL(conjf)(c);
}
CLANG_PORT_INLINE long double complex  conjl(long double complex c)
{
	return CLANG_BUILTIN_CALL(conjl)(c);
}
CLANG_PORT_INLINE double complex cpow(double complex b, double complex c)
{
	return CLANG_BUILTIN_CALL(cpow)(b,c);
}
CLANG_PORT_INLINE float complex cpowf(float complex b, float complex c)
{
	return CLANG_BUILTIN_CALL(cpowf)(b,c);
}
CLANG_PORT_INLINE long double complex  cpowl(long double complex b, long double complex c)
{
	return CLANG_BUILTIN_CALL(cpowl)(b,c);
}
CLANG_PORT_INLINE double complex cproj(double complex c)
{
	return CLANG_BUILTIN_CALL(cproj)(c);
}
CLANG_PORT_INLINE float complex cprojf(float complex c)
{
	return CLANG_BUILTIN_CALL(cprojf)(c);
}
CLANG_PORT_INLINE long double complex  cprojl(long double complex c)
{
	return CLANG_BUILTIN_CALL(cprojl)(c);
}
CLANG_PORT_INLINE double creal(double complex c)
{
	return CLANG_BUILTIN_CALL(creal)(c);
}
CLANG_PORT_INLINE float crealf(float complex c)
{
	return CLANG_BUILTIN_CALL(crealf)(c);
}
CLANG_PORT_INLINE long double creall(long double complex c)
{
	return CLANG_BUILTIN_CALL(creall)(c);
}
CLANG_PORT_INLINE double complex csin(double complex c)
{
	return CLANG_BUILTIN_CALL(csin)(c);
}
CLANG_PORT_INLINE float complex csinf(float complex c)
{
	return CLANG_BUILTIN_CALL(csinf)(c);
}
CLANG_PORT_INLINE double complex csinh(double complex c)
{
	return CLANG_BUILTIN_CALL(csinh)(c);
}
CLANG_PORT_INLINE float complex csinhf(float complex c)
{
	return CLANG_BUILTIN_CALL(csinhf)(c);
}
CLANG_PORT_INLINE long double complex  csinhl(long double complex c)
{
	return CLANG_BUILTIN_CALL(csinhl)(c);
}
CLANG_PORT_INLINE long double complex  csinl(long double complex c)
{
	return CLANG_BUILTIN_CALL(csinl)(c);
}
CLANG_PORT_INLINE double complex csqrt(double complex c)
{
	return CLANG_BUILTIN_CALL(csqrt)(c);
}
CLANG_PORT_INLINE float complex csqrtf(float complex c)
{
	return CLANG_BUILTIN_CALL(csqrtf)(c);
}
CLANG_PORT_INLINE long double complex  csqrtl(long double complex c)
{
	return CLANG_BUILTIN_CALL(csqrtl)(c);
}
CLANG_PORT_INLINE double complex ctan(double complex c)
{
	return CLANG_BUILTIN_CALL(ctan)(c);
}
CLANG_PORT_INLINE float complex ctanf(float complex c)
{
	return CLANG_BUILTIN_CALL(ctanf)(c);
}
CLANG_PORT_INLINE double complex ctanh(double complex c)
{
	return CLANG_BUILTIN_CALL(ctanh)(c);
}
CLANG_PORT_INLINE float complex ctanhf(float complex c)
{
	return CLANG_BUILTIN_CALL(ctanhf)(c);
}
CLANG_PORT_INLINE long double complex  ctanhl(long double complex c)
{
	return CLANG_BUILTIN_CALL(ctanhl)(c);
}
CLANG_PORT_INLINE long double complex  ctanl(long double complex c)
{
	return CLANG_BUILTIN_CALL(ctanl)(c);
}
#endif /* __IMPL_CLANG_PORT_API_ */


// not builtin functions
	typedef double CLANG_PORT_FPTR_TYPE(cacosh)(double complex c);
	extern CLANG_PORT_FPTR_VAR(cacosh);
	typedef float CLANG_PORT_FPTR_TYPE(cacoshf)(float complex c);
	extern CLANG_PORT_FPTR_VAR(cacoshf);
	typedef long double CLANG_PORT_FPTR_TYPE(cacoshl)(long double complex c);
	extern CLANG_PORT_FPTR_VAR(cacoshl);
	
	typedef double CLANG_PORT_FPTR_TYPE(casinh)(double complex c);
	extern CLANG_PORT_FPTR_VAR(casinh);
	typedef float CLANG_PORT_FPTR_TYPE(casinhf)(float complex c);
	extern CLANG_PORT_FPTR_VAR(casinhf);
	typedef long double CLANG_PORT_FPTR_TYPE(casinhl)(long double complex c);
	extern CLANG_PORT_FPTR_VAR(casinhl);

	typedef double CLANG_PORT_FPTR_TYPE(catanh)(double complex c);
	extern CLANG_PORT_FPTR_VAR(catanh);
	typedef float CLANG_PORT_FPTR_TYPE(catanhf)(float complex c);
	extern CLANG_PORT_FPTR_VAR(catanhf);
	typedef long double CLANG_PORT_FPTR_TYPE(catanhl)(long double complex c);
	extern CLANG_PORT_FPTR_VAR(catanhl);
	
#ifndef __IMPL_CLANG_PORT_API_
// not builtin functions
	CLANG_PORT_INLINE double complex cacosh(double complex c)
	{
		return CLANG_PORT_CALL_FPTR(cacosh)(c);
	}
	CLANG_PORT_INLINE float complex cacoshf(float complex c)
	{
		return CLANG_PORT_CALL_FPTR(cacoshf)(c);
	}
	CLANG_PORT_INLINE long double complex  cacoshl(long double complex c)
	{
		return CLANG_PORT_CALL_FPTR(cacoshl)(c);
	}
	CLANG_PORT_INLINE double complex casinh(double complex c)
	{
		return CLANG_PORT_CALL_FPTR(casinh)(c);
	}
	CLANG_PORT_INLINE float complex casinhf(float complex c)
	{
		return CLANG_PORT_CALL_FPTR(casinhf)(c);
	}
	CLANG_PORT_INLINE long double complex  casinhl(long double complex c)
	{
		return CLANG_PORT_CALL_FPTR(casinhl)(c);
	}
	CLANG_PORT_INLINE double complex catanh(double complex c)
	{
		return CLANG_PORT_CALL_FPTR(catanh)(c);
	}
	CLANG_PORT_INLINE float complex catanhf(float complex c)
	{
		return CLANG_PORT_CALL_FPTR(catanhf)(c);
	}
	CLANG_PORT_INLINE long double complex  catanhl(long double complex c)
	{
		return CLANG_PORT_CALL_FPTR(catanhl)(c);
	}
#endif /* __IMPL_CLANG_PORT_API_ */

#ifdef __cplusplus
}
#endif 


#endif /* _CLANG_PORT_COMPLEX_H_ */
